package com.tensquare.jwt;

import io.jsonwebtoken.JwtBuilder;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;

import java.util.Date;

public class CreateJwt {

    public static void main(String[] args) {

        //setIssuedAt用于设置签发时间
        //signWith用于设置签名秘钥
        JwtBuilder jwtBuilder = Jwts.builder().setId("888")
                .setSubject("小白")
                .setIssuedAt(new Date())
                .signWith(SignatureAlgorithm.HS256, "itcast");
        System.out.println(jwtBuilder.compact());

    }

}
